<?php

namespace app\command;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use app\order\logic\TagLabelLogic;
use app\order\logic\OrderLogic;
use think\facade\Cache;
class TagLabelConsummer extends Command
{

        protected function configure()
        {
                $this->setName('TagLabelConsummer')
                ->setDescription('TagLabelConsummer');
        }

        protected function execute(Input $input, Output $output)
        {
                //新增cancellationTag标签
                (new TagLabelLogic())->cancellationTag();
                //新增ReturnTag标签
                (new TagLabelLogic())->ReturnTag();
                //新增LogisticTag标签
                (new TagLabelLogic())->LogisticTag();
                //新增OthersTag标签
                (new TagLabelLogic())->OthersTag();
        // 1、Dispute、First、daijinquan，满足条件就打标
        // 2、其他标签唯一性，优先级如下：Meifaaaaaa＞Return＞cancellation＞Logistic

        //5小时更新一次
        $cancellationTag = Cache::store('redis')->get('cancellationTag');
        if (empty($cancellationTag)) {  
            Cache::store('redis')->set('cancellationTag', 1, 3600 * 16);
        }else{
                echo '时间没到先不更新';die;
        }

                //新增Dispute标签
                (new TagLabelLogic())->DisputeTag();

                // 标签
                 //新增daijinquan标签-匹配关键词 vouchers/coupons/gift card/partial refund
                (new TagLabelLogic())->DaijinquanTag();
                //新增First标签
                (new TagLabelLogic())->FirstTag();die;

                //整理未发货的客户
                (new TagLabelLogic())->UnshippedCustomers();
                //给未发货的客户打标签---Meifaaaaaa----截止4月1号
                (new TagLabelLogic())->WorkOrderLabel();

        }
}